home *** CD-ROM | disk | FTP | other *** search
/ PC World 1999 April / PCWorld_1999-04_cd.bin / Software / Vyzkuste / LearnVB6 / VB Code / Class 3 / Example3-1.frm (.txt) next >
Visual Basic Form  |  1998-04-14  |  3KB  |  100 lines

  1. VERSION 5.00
  2. Begin VB.Form frmPassword 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Password Validation"
  5.    ClientHeight    =   2550
  6.    ClientLeft      =   4845
  7.    ClientTop       =   4260
  8.    ClientWidth     =   5790
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   2550
  14.    ScaleWidth      =   5790
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CommandButton cmdExit 
  17.       Cancel          =   -1  'True
  18.       Caption         =   "E&xit"
  19.       Height          =   372
  20.       Left            =   3480
  21.       TabIndex        =   3
  22.       Top             =   1800
  23.       Width           =   972
  24.    End
  25.    Begin VB.CommandButton cmdValid 
  26.       Caption         =   "&Validate"
  27.       Default         =   -1  'True
  28.       Height          =   372
  29.       Left            =   1320
  30.       TabIndex        =   2
  31.       Top             =   1800
  32.       Width           =   972
  33.    End
  34.    Begin VB.TextBox txtPassword 
  35.       BeginProperty Font 
  36.          Name            =   "MS Sans Serif"
  37.          Size            =   13.5
  38.          Charset         =   0
  39.          Weight          =   400
  40.          Underline       =   0   'False
  41.          Italic          =   0   'False
  42.          Strikethrough   =   0   'False
  43.       EndProperty
  44.       Height          =   480
  45.       IMEMode         =   3  'DISABLE
  46.       Left            =   1800
  47.       PasswordChar    =   "*"
  48.       TabIndex        =   0
  49.       Tag             =   "LouTylee"
  50.       Top             =   960
  51.       Width           =   2292
  52.    End
  53.    Begin VB.Label Label1 
  54.       Alignment       =   2  'Center
  55.       BorderStyle     =   1  'Fixed Single
  56.       Caption         =   "Please Enter Your Password:"
  57.       BeginProperty Font 
  58.          Name            =   "MS Sans Serif"
  59.          Size            =   9.75
  60.          Charset         =   0
  61.          Weight          =   700
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       Height          =   372
  67.       Left            =   600
  68.       TabIndex        =   1
  69.       Top             =   240
  70.       Width           =   4572
  71.    End
  72. Attribute VB_Name = "frmPassword"
  73. Attribute VB_GlobalNameSpace = False
  74. Attribute VB_Creatable = False
  75. Attribute VB_PredeclaredId = True
  76. Attribute VB_Exposed = False
  77. Option Explicit
  78. Private Sub cmdExit_Click()
  79. End Sub
  80. Private Sub cmdValid_Click()
  81. 'This procedure checks the input password
  82. Dim Response As Integer
  83. If txtPassword.Text = txtPassword.Tag Then
  84. 'If correct, display message box
  85.   MsgBox "You've passed security!", vbOKOnly + vbExclamation, "Access Granted"
  86. 'If incorrect, give option to try again
  87.   Response = MsgBox("Incorrect password", vbRetryCancel + vbCritical, "Access Denied")
  88.   If Response = vbRetry Then
  89.     txtPassword.SelStart = 0
  90.     txtPassword.SelLength = Len(txtPassword.Text)
  91.   Else
  92.     End
  93.   End If
  94. End If
  95. txtPassword.SetFocus
  96. End Sub
  97. Private Sub Form_Activate()
  98. txtPassword.SetFocus
  99. End Sub
  100.